import React, { useEffect } from "react";
import { Button } from "antd";
import { useDispatch ,connect,useStore,useSelector} from "react-redux";
import { increment,decrement,incrementAsync } from "../../store/action/salary";

export default ()=>{

  const dispatch =useDispatch()
  const {salary} = useSelector(state => state.salaryReduce)
  const store =useStore()


useEffect(()=>{
  console.log(salary)
},[dispatch])
      return <div>
        <h1 style={{fontSize:"100px"}}>薪资{salary}</h1>
        <Button type="primary" onClick={()=>{console.log(store.getState()) 
          dispatch(increment(1))}}>+1000</Button>
        <Button type="default" onClick={()=>{dispatch(decrement())}}>-1000</Button>
        <Button type="ghost" onClick={()=>{
           
          dispatch(incrementAsync({data:"2"},5000))
          console.log(store.getState())
          }}>延期+1000</Button>
      </div>
  }
